package com.lanou.service.imp;

import com.lanou.bean.Blog;
import com.lanou.bean.PageBean;
import com.lanou.mapper.BlogMapper;
import com.lanou.service.BlogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by dllo on 18/2/26.
 */
@Service
public class BlogServiceImp implements BlogService {
    @Resource
    private BlogMapper blogMapper;

    @Override
    public PageBean<Blog> listBlog(String title, PageBean<Blog> pageBean) {
        /*Map<String,Object> map = new HashMap<String,Object>();
        //设置查询条件
        map.put("title",title);
        //总记录放入pageBean
        pageBean.setTotal(blogDao.getTotal(map));
        map.put("start",pageBean.getStart());
        map.put("end",pageBean.getEnd());
        //把分页结果放入pageBean
        pageBean.setResult(blogDao.listBlog(map));*/
        return pageBean;
    }

    @Override
    public int count() {
        return blogMapper.count();
    }

    @Override
    public List<Blog> selecBloyByUid(int currentPage) {
        return blogMapper.selecBloyByUid(currentPage);
    }

    @Override
    public void add(Blog blog) {
        blogMapper.addBlog(blog);
    }

    @Override
    public void del(Integer id) {
        blogMapper.deleteBlog(id);
    }

    @Override
    public void update(Blog blog) {
        blogMapper.updateBlog(blog);
    }

    @Override
    public List<Blog> selectAll() {
        return blogMapper.selectall();
    }


}
